package geotransform.tools;

import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

import geotransform.*;
import geotransform.coords.*;
import geotransform.datum.*;
import geotransform.ellipsoids.*;
import geotransform.transforms.*;


public class ConvertCoordSystem {
	public Gdc_Coord_3d geo;
	public Utm_Coord_3d utm;
	
	public static Utm_Coord_3d geoToUtm(Gdc_Coord_3d g, String datum) throws Exception{
		Utm_Coord_3d u = new Utm_Coord_3d();
		
		if(datum.equals("wgs"))
			Gdc_To_Utm_Converter.Init(new WE_Ellipsoid());
		else if(datum.equals("sad"))
			Gdc_To_Utm_Converter.Init(new SA_Ellipsoid());
		
		Gdc_To_Utm_Converter.Convert(g,u);
		return u;
	}
	
	public static Gdc_Coord_3d utmToGeo(Utm_Coord_3d u, String datum) throws Exception{
		Gdc_Coord_3d g = new Gdc_Coord_3d();
		
		if(datum.equals("wgs"))
			Utm_To_Gdc_Converter.Init(new WE_Ellipsoid());
		else if(datum.equals("sad"))
			Utm_To_Gdc_Converter.Init(new SA_Ellipsoid());
		
		Utm_To_Gdc_Converter.Convert(u,g);
		
		return g;
	}
}
